﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Psn1a00
    {
        private int? _depcode;
		private string _depname;
		private string _comname;
        private int? _comcode;
		private string _principalname;
		private string _ntel;
		private string _fax;
		private string _usercode;
		private string _listid;
		
        /// <summary>
        /// 部门代码
        /// </summary>
		public int? Depcode
		{
			get { return _depcode;	 }
			set { _depcode=value;	}
		}
        /// <summary>
        /// 部门名称
        /// </summary>
		public string Depname
		{
			get { return _depname;	 }
			set { _depname=value;	}
		}
        /// <summary>
        /// 公司名称
        /// </summary>
		public string Comname
		{
			get { return _comname;	 }
			set { _comname=value;	}
		}
        /// <summary>
        /// 公司代码
        /// </summary>
		public int? Comcode
		{
			get { return _comcode;	 }
			set { _comcode=value;	}
		}
        /// <summary>
        /// 负责人
        /// </summary>
		public string Principalname
		{
			get { return _principalname;	 }
			set { _principalname=value;	}
		}
        /// <summary>
        /// 联系电话
        /// </summary>
		public string Ntel
		{
			get { return _ntel;	 }
			set { _ntel=value;	}
		}
        /// <summary>
        /// 传真
        /// </summary>
		public string Fax
		{
			get { return _fax;	 }
			set { _fax=value;	}
		}
        /// <summary>
        /// 用户名
        /// </summary>
		public string Usercode
		{
			get { return _usercode;	 }
			set { _usercode=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
		
		public static List<Psn1a00> GetPsn1a00ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Psn1a00> list = new List<Psn1a00>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Psn1a00 model = GetPsn1a00ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Psn1a00 GetPsn1a00ByDataRow(DataRow dr)
		{
			Psn1a00 model = new Psn1a00(); //实例化Psn1a00
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("depcode")&&!(dr["depcode"] is System.DBNull))  
				model.Depcode = ( int)dr["depcode"];
			if (dcc.Contains("depname")&&!(dr["depname"] is System.DBNull))  
				model.Depname = ( string)dr["depname"];
			if (dcc.Contains("comname")&&!(dr["comname"] is System.DBNull))  
				model.Comname = ( string)dr["comname"];
			if (dcc.Contains("comcode")&&!(dr["comcode"] is System.DBNull))  
				model.Comcode = ( int)dr["comcode"];
			if (dcc.Contains("principalname")&&!(dr["principalname"] is System.DBNull))  
				model.Principalname = ( string)dr["principalname"];
			if (dcc.Contains("ntel")&&!(dr["ntel"] is System.DBNull))  
				model.Ntel = ( string)dr["ntel"];
			if (dcc.Contains("fax")&&!(dr["fax"] is System.DBNull))  
				model.Fax = ( string)dr["fax"];
			if (dcc.Contains("usercode")&&!(dr["usercode"] is System.DBNull))  
				model.Usercode = ( string)dr["usercode"];
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			
			return model;
		}
    }
}
